package db.domain;

import sf.core.DBObject;
import sf.database.annotations.ColumnInfo;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import java.util.Date;

/**
 * 评论(与数据对应)
 * @author SXF
 */
@Entity
@Table(name = "comments")
public class Comment extends DBObject {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    /**
     * 回复的评论ID
     */
    @ColumnInfo(unsigned = true)
    @Column(name = "parent_id")
    private Long parentId;
    /**
     * 评论的内容ID
     */
    @Column(name = "content_id")
    private Long contentId;
    /**
     * 评论的内容模型
     */
    @Column(name = "content_module")
    private String contentModule;
    /**
     * 评论的回复数量
     */
    @Column(name = "comment_count")
    private Long commentCount;
    /**
     * 排序编号，常用语置顶等
     */
    @Column(name = "order_number")
    private Long orderNumber;
    /**
     * 评论的用户ID
     */
    @Column(name = "user_id")
    private Long userId;
    /**
     * 评论的IP地址
     */
    @Column
    private String ip;
    /**
     * 评论的作者
     */
    @Column
    private String author;
    /**
     * 评论的类型，默认是comment
     */
    @sf.database.annotations.Comment("类型")
    @ColumnInfo(defaultVale = "'comment'")
    @Column(nullable = false)
    private String type;
    /**
     * 评论的内容
     */
    @Lob
    @Column
    private String text;
    /**
     * 提交评论的浏览器信息
     */
    @Lob
    @Column
    private String agent;
    /**
     * 评论的时间
     */
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    private Date created;
    /**
     * 评论的slug
     */
    @Column
    private String slug;
    /**
     * 评论用户的email
     */
    @Column
    private String email;
    /**
     * 评论的状态
     */
    @Column
    private String status;
    /**
     * “顶”的数量
     */
    @Column(name = "vote_up")
    private Long voteUp;
    /**
     * “踩”的数量
     */
    @Column(name = "vote_down")
    private Long voteDown;
    /**
     * 标识
     */
    @Column
    private String flag;
    /**
     * 纬度
     */
    @Column(precision = 20, scale = 16)
    private Double lat;
    /**
     * 经度
     */
    @Column(precision = 20, scale = 16)
    private Double lng;

    private static final long serialVersionUID = 1L;

    public Comment() {

    }

    public enum Field implements sf.core.DBField {
        id, parentId, contentId, contentModule, commentCount, orderNumber, userId, ip, author, type, text, agent, created,
        slug, email, status, voteUp, voteDown, flag, lat, lng
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getContentId() {
        return contentId;
    }

    public void setContentId(Long contentId) {
        this.contentId = contentId;
    }

    public String getContentModule() {
        return contentModule;
    }

    public void setContentModule(String contentModule) {
        this.contentModule = contentModule;
    }

    public Long getCommentCount() {
        return commentCount;
    }

    public void setCommentCount(Long commentCount) {
        this.commentCount = commentCount;
    }

    public Long getOrderNumber() {
        return orderNumber;
    }

    public void setOrderNumber(Long orderNumber) {
        this.orderNumber = orderNumber;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getIp() {
        return ip;
    }

    public void setIp(String ip) {
        this.ip = ip;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public String getAgent() {
        return agent;
    }

    public void setAgent(String agent) {
        this.agent = agent;
    }

    public Date getCreated() {
        return created;
    }

    public void setCreated(Date created) {
        this.created = created;
    }

    public String getSlug() {
        return slug;
    }

    public void setSlug(String slug) {
        this.slug = slug;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public Long getVoteUp() {
        return voteUp;
    }

    public void setVoteUp(Long voteUp) {
        this.voteUp = voteUp;
    }

    public Long getVoteDown() {
        return voteDown;
    }

    public void setVoteDown(Long voteDown) {
        this.voteDown = voteDown;
    }

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    public Double getLat() {
        return lat;
    }

    public void setLat(Double lat) {
        this.lat = lat;
    }

    public Double getLng() {
        return lng;
    }

    public void setLng(Double lng) {
        this.lng = lng;
    }

}
